package com.itheima.controller;

import com.itheima.entity.Result;
import com.itheima.pojo.WebConfig;
import com.itheima.service.WebConfigService;
import com.itheima.vo.WebConfigVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: Felix(李鑫)
 * @Date: 2020/9/1 19:22
 * @Description:  获取网站配置
 */

@RestController
@RequestMapping("/webConfig")
public class WebConfigController {

    @Autowired
    private WebConfigService webConfigService;

    /**
     * 修改网站配置
     * @param webConfigVO
     * @return
     */
    @RequestMapping("/editWebConfig")
    public Result editWebConfig(WebConfigVO webConfigVO){
       webConfigService.edit(webConfigVO);
        return new Result("success","修改成功");
    }


    /**
     *  获取网站配置
     * @return
     */
    @RequestMapping("/getWebConfig")
    public Result getWebConfig(){
        List<WebConfig> webConfig = webConfigService.getWebConfig();
        return new Result("success",webConfig);
    }
}
